package com.bestdreamer.stream;

import com.bestdreamer.pojo.User;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class MapStreamTest2 {

    public static void main(String[] args) {
        User user1 = new User("1","zhangsan",1,"2010-10-10");
        User user2 = new User("2","lisi",1,"1980-9-10");
        User user3 = new User("3","wangwu",1,"1990-1-10");
        User user4 = new User("4","xiaosan",0,"2000-10-10");
        List<User> list = new ArrayList<>();
        list.add(user1);
        list.add(user2);
        list.add(user3);
        list.add(user4);
        List<User> list1 = new ArrayList<>();
        list.forEach(user -> {
            if(user.getSex().equals(1)){
                list1.add(user);
            }
        });
        System.out.println(list);
        System.out.println(list1);
        List filterList = list1.stream().filter(user -> user.getBirthday().contains("10-10")).collect(Collectors.toList());
        System.out.println(filterList);

    }



}
